package jse;

import java.util.HashMap;

import jse.log.Logs;

public class Routes {
	private Routes() {}
	private final static Routes instance=new Routes();
	public final static HashMap<String, Route> routes=new HashMap<String, Route>();
	public static Routes create() {
		return instance;
	}
	public static Routes add(String path,Route route) {
		routes.put(path, route);
		Logs.get().info("添加路由>>:method:* path:%s  ",path);
		return instance;
	}
	public static Routes add(String path,Route route,String method) {
		routes.put(path, route);
		Logs.get().info("添加路由>>:method%s path:%s",method,path);
		return instance;
	}
	public static Route get(String oriUrl) {
		return routes.get(oriUrl);
	}
	public static void remove(String oldurl) {
		routes.remove(oldurl);
		Logs.get().info("删除路由 %s 成功!",oldurl);
	}
}
